<style>
.setimg{
	margin:-2px 5px 0 0 
}
</style>
<?php
	$cashStatus = array(
		'未处理','提现成功','提现失败'
	);
	$cashIcon = array(
		'label label-default','label label-success','label label-warning'
	);
?>
<div class="row-fluid">
	<a style="border:1px solid #ccc" class="block-heading" data-toggle="collapse">列表数据</a>
    <div class="well">
	    <div class="btn-toolbar">
		    <form>
		    	<label style="display: inline;">用户名称：</label><input class="input input-medium" type="text" name="cust_realname" value="<?=I('get.cust_realname')?>" />
		    	<label style="display: inline;margin-left:10px">手机号码：</label><input class="input input-medium" type="text" name="cust_mobile" value="<?=I('get.cust_mobile')?>" />
		    	<label style="display: inline;margin-left:10px">流水类型：</label>
				<label style="display: inline;margin-left:10px">提现状态：</label>
				<select style="width:150px;" name="status">
					<option value="-1">全部</option>
					<option value='0' <?='0'==I('get.status') ? 'selected="selected"' : ''?>>未处理</option>
					<option value='1' <?='1'==I('get.status') ? 'selected="selected"' : ''?>>提现成功</option>
					<option value='2' <?='2'==I('get.status') ? 'selected="selected"' : ''?>>提现失败</option>
				</select>
		    	<input type="hidden" value="<?=I('get.res')?>" name="res" />
		    	<button class="btn btn-info" style="margin:-9px 0 0 15px"><i class="icon-search"></i> 搜索</button>
		    </form>
		</div>
		<hr>
		<table class="table">
		      <thead>
		        <tr>
		          <th style="text-align:center">序号id</th>
		          <th style="text-align:center">提现金额</th>
		          <th style="text-align:center">用户姓名</th>
		          <th style="text-align:center">提现参数</th>
		          <th style="text-align:center">手机号码</th>
		          <th style="text-align:center">申请时间</th>
		          <th style="text-align:center">提现状态</th>
		      	  <th style="text-align:center">操作</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<?php if($getData){foreach($getData AS $key=>$val){ ?>
		        <tr> 
		          <td style="text-align:center;vertical-align:middle"><?=$val['cust_cashid']?></td>
		          <td style="text-align:center;vertical-align:middle"><?=$val['cash_money']?> 元</td>
		          <td style="text-align:center;vertical-align:middle"><?=$val['cust_realname'] ?: '-'?></td>
		          <td style="text-align:center;vertical-align:middle"><center><table style="text-align:center"><tr><td>账户姓名：<?=$val['bank_uname']?></td><td>账户类型：<?=$val['bank']?></td></tr><tr><td colspan=2>提现帐号：<?=$val['bank_card']?></td></tr></table></center></td>
		          <td style="text-align:center;vertical-align:middle"><?=$val['cust_mobile']?></td>
		          <td style="text-align:center;vertical-align:middle"><?=date('Y-m-d H:i',$val['add_at'])?></td>
		          <td style="text-align:center;vertical-align:middle"><span class="<?=$cashIcon[$val['cash_status']]?>"><?=$cashStatus[$val['cash_status']]?></span></td>
		          <td style="text-align:center;vertical-align:middle" class="inblank"><?php if($val['cash_status']=='0'){?>
		          			<a class="btn btn-primary icheck" style="padding: 2px 10px"  href="#myModal" data-toggle="modal" itv="<?=$val['cust_cashid']?>">处理</a>
		          		<?php }?></td>
		        </tr>
		        <?php }}else{?>
		        <tr><td style="text-align:center;vertical-align:middle" colspan=8>暂无数据</td></tr>
		        <?php }?>
		      </tbody>
		   </table>
		   <span style="float:right;margin-top:-44px"><?=$page?></span>
	</div>
</div>
<div class="modal small hide fade" itav="0" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">处理结果</h3>
  </div>
  <div class="modal-body">
    <p class="error-text"><center>
  	  <select name="status" id="ostatus" style="width:180px">
  	  	<option value=1>确认打款，提现成功</option>
  	  	<option value=2>提现失败</option>
  	  </select>
  	 </center></p>
  	 <input type="hidden" value="0" class="setCashId" />
  </div>
  <div class="modal-footer">
    <button class="btn" id="setResult" data-dismiss="modal" aria-hidden="true">确定</button>
  </div>
</div>
<script>
$(function(){
	$('.icheck').click(function(){
		$('.setCashId').val($(this).attr('itv'));
	});
	$('#setResult').click(function(){
		if($('.setCashId').val() > 0){
			art.dialog({
				title: '',
				lock: true,
				background: '#333',
				opacity: 0.87,
				drag: false,
			    resize: false,
				content: '<img src="/statics/arts/skins/icons/loading.gif" /> 处理中，请稍候..'
			});$('.aui_close').hide();
			$.post('/cash/setCash',{'status':$('#ostatus :selected').val(),'cashid':$('.setCashId').val()},function(data){
				var list = art.dialog.list;
				for (var i in list) {
					list[i].close();
				};
				showmsg(data.msg,data.code);
				setTimeout(function(){location.reload();},1000);
			},'json');
		}
	});
	$('.inblank').each(function(){
		if($(this).html() == ''){
			$(this).html('-');
		}
	});
})
</script>